<?php

	if (!empty($post['Author'][Configure::read('Lil.authorDisplayField')])) {
		printf(
			__d('lil_blogs', 'Posted %1$s by %2$s', true),
			$this->Time->timeAgoInWords($post['Post']['created']),
			$post['Author'][Configure::read('Lil.authorDisplayField')]
		);
	} else {
		printf(
			__d('lil_blogs', 'Posted %s', true),
			$this->Time->timeAgoInWords($post['Post']['created'])
		);
	}
	
	// display list of categories
	if (!empty($post['Category'])) {
		echo ' ' . __d('lil_blogs', 'in', true) . ' ';
		
		echo $this->Text->toList(
			Set::format(
				$post, 
				$this->Html->link('%1$s', array(
					'controller' => 'posts',
					'action'     => 'index',
					'blog'       => $blog['Blog'][Configure::read('Lil.areaSlugField')],
					'category'   => '%2$s'
				)), 
				array('Category.{n}.name', 'Category.{n}.id')
			),
			__d('lil_blogs', 'and', true)
		);
	}
	
	// show no of comments
	echo ' (';
	// this is neccessary because of i18n extraction requires variable
	$comment_count = $post['Post']['no_comments'];
	echo $this->Html->link(
		sprintf(
			__dn('lil_blogs', '1 comment', '%d comments', $comment_count, true), $comment_count
		),
		array(
			'plugin'     => 'lil_blogs',
			'controller' => 'posts',
			'action'     => 'view',
			'blog'       => $blog['Blog'][Configure::read('Lil.areaSlugField')],
			'post'       => $post['Post']['slug'] . '#comments',
		)
	);
	echo ')';
	
	// show "edit this post" link
	if ($this->Lil->user('id')) {
		echo ' | ';
		echo $this->Html->link(
			__d('lil_blogs', 'Edit this post', true),
			array(
				'admin'   => true,
				'action'  => 'edit',
				'area_id' => $post['Blog']['id'],
				$post['Post']['id']
			)
		);
	}
?>